package io.adrainty.bolee.security.web;

import cn.hutool.crypto.asymmetric.RSA;
import io.adrainty.bolee.framework.commons.basic.ResultDTO;
import io.adrainty.bolee.framework.commons.utils.ResultDTOUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author AdRainty
 * @version V1.0.0
 * @since 2025/8/3 上午1:27
 */

@RestController
@RequestMapping("/rsa")
@Tag(name = "RsaController", description = "密钥接口")
public class RsaController {

    @Resource
    private RSA rsa;

    @GetMapping("/public-key")
    @Operation(summary = "获取公钥")
    public ResultDTO<String> getPublicKey() {
        return ResultDTOUtil.success(rsa.getPublicKeyBase64());
    }

}
